package com.dnjn.happiness.system.api;

import com.dnjn.happiness.common.core.constant.SecurityConstants;
import com.dnjn.happiness.common.core.constant.ServiceNameConstants;
import com.dnjn.happiness.common.core.domain.R;
import com.dnjn.happiness.common.core.model.SysPostVO;
import com.dnjn.happiness.system.api.factory.RemotePostFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.List;

@FeignClient(contextId = "remotePostService",value = ServiceNameConstants.SYSTEM_SERVICE,fallbackFactory = RemotePostFallbackFactory.class)
public interface RemotePostService {

    @GetMapping(value = "/post/getInfoById/{postId}")
    public R<SysPostVO> getInfoById(@PathVariable("postId") Long postId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping(value = "/post/queryPostListByDeptId/{deptId}")
    public R<List<SysPostVO>> queryPostListByDeptId(@PathVariable("deptId") Long deptId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping(value = "/post/selectPostsByUserId/{userId}")
    public R<List<SysPostVO>> selectPostsByUserId(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
